package com.pumpkin.asyncdemo.component;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

@Component
public class Task extends AbstractTask{

    @Async("taskExecutor")
    @Override
    public void doTaskOne(String name) throws InterruptedException, ExecutionException {
        super.doTaskOne(name);
        System.out.println("当前线程：" + Thread.currentThread().getName());
    }

    @Async("taskExecutor")
    @Override
    public void doTaskTwo() throws InterruptedException, ExecutionException {
        super.doTaskTwo();
        System.out.println("当前线程：" + Thread.currentThread().getName());
    }

    @Async("taskExecutor")
    @Override
    public void doTaskThree() throws InterruptedException, ExecutionException {
        super.doTaskThree();
        System.out.println("当前线程：" + Thread.currentThread().getName());
    }
}
